package controller

import (
	"project1/service"
	"project1/validate"

	"github.com/kataras/iris/v12"
)

type EncryptionController struct {
	BaseController
	Service *service.EncryptionService
}

// 构造函数
func NewEncryptionController() *EncryptionController {
	return &EncryptionController{
		BaseController: *NewBaseController(),
	}
}

// 获取指定币信息
func (e *EncryptionController) Coinglass_Appoint(ctx iris.Context) {
	bodyData := validate.CoinName{}
	err := e.ValidateParams.CheckStructParams(ctx.FormValues(), map[string][]string{
		"int": {"page", "pageSize"},
	}, &bodyData)
	if err != nil {
		e.ApiReturn(ctx, "", err)
		return
	}
	// 搜索指定币
	data, err := e.Service.Coinglass_Appoint(bodyData)
	e.ApiReturn(ctx, data, err)
}
